<template>



借款名称

<input type="text" v-model="data.Mname">




利息下
<select v-model="data.Lid">

<option value="-1">请选择</option>
<option v-for="item in hk" :value=" item.Lid ">{{ item.SNname }}</option>
</select>
<input type="button" @click="showhtml" value="查询">

<table class="table table-bordered">
  <tr>
    <td>借款款项编号</td>
    <td>借款款项名称</td>
    <td>借款最高金额</td>
    <td>借款最高年限</td>
    <td>利息编号</td>
    <td>借款款项简介</td>
    <td>月还款金额</td>
    <td>操作</td>
  </tr>
  <tr v-for="item in list">
    <td>{{item.Mid}}</td>
    <td>{{item.Mname}}</td>
    <td>2000</td>
    <td>{{item.Getyear}}</td>
    <td>{{item.Lid}}</td>
    <td>{{item.lMess}}</td>
    <td>{{(2000 /(item.Getyear*12))}}</td>
    <td>
      <input type="button" @click="showdelet(item.Mid)" value="删除"></input>
      <input type="button"  value="修改"></input>
    </td>
  </tr>
</table>
</template>

<script setup lang="ts">

import { reactive,toRefs,onMounted } from 'vue';

import axios from 'axios';


import { useRouter } from 'vue-router';


  let state=reactive({

    data:{
      Mname:'',
      Getmon:'',
      Getyear:'',
      Lid:'-1',
      lMess:'',
    },
    list:[],
    hk:[],


  })


  const {data,list,hk} = toRefs(state)

//就绪函数
  onMounted(()=>{
    Monselect()
    //显示页面
    showhtml()

  })


//利息下拉框
const Monselect:any=(()=>{

axios({

  url:"https://localhost:44305/api/Default/GEtselect",
  method:"get",

})
.then(res=>{
  console.log(res)
  hk.value=res.data.data


})
  .catch(err=>{



  })




})


//删除
const showdelet=((id:any)=>{

if(confirm('确定删除吗?'))
{
  axios({

url:"https://localhost:44305/api/Default/ShoeDelet",
method:'get',
params:{

  id:id

}


})

.then(res=>{

if(res.data.data>0)
{
  alert('删除成功')
  showhtml()
}

})
}


})




//显示页面
const showhtml=(()=>{


  axios({

    url:'https://localhost:44305/api/Default/Showhtml',
  method:"get",
    params:{

      Gname:state.data.Mname,
      id:state.data.Lid
    }


  })
  .then(res=>{
    list.value=res.data.data

  })
  .catch(err=>{

  })


})


</script>

<style scoped>

</style>